package cz.muni.fi.pa165.languageschool.dao;

import cz.muni.fi.pa165.languageschool.Lecture;
import cz.muni.fi.pa165.languageschool.Lecturer;
import cz.muni.fi.pa165.languageschool.Student;
import java.util.Collection;
import java.util.List;

/**
 * Interface of Data Access Object managing Lecture entities state within data
 * storage
 *
 * @author Michal Fučík (395624) michal.fuca.fucik(at)gmail.com, Milos Petrovic
 * (256790) mpetrovickg(at)gmail.com
 */
public interface LectureDao {

    /**
     * Create a new lecture. Lecture cannot be null
     *
     * @param lecture The lecture entity. Lecture cannot be null
     */
    void createLecture(Lecture lecture);

    /**
     * Fetches all lectures from the database
     *
     * @return collection of lectures
     */
    Collection<Lecture> getAllLectures();

    /**
     * Get lecture by lecture id. Lecture cannot be null
     *
     * @param id Id cannot be null
     * @return lecture
     */
    Lecture getLecture(Long id);

    /**
     * Updates lecture entity within the database
     *
     * @param lecture
     */
    void updateLecture(Lecture lecture);

    /**
     * Removes given entity from the database
     *
     * @param lecture
     */
    void deleteLecture(Lecture lecture);

    /**
     * Fetches lecture's lecturer
     *
     * @param lecture
     * @return related lecturer
     */
    Lecturer getLecturesLecturer(Lecture lecture);

    /**
     * Attaches lecturer to appropriate lecture
     *
     * @param lectureId
     * @param lecturer
     */
    void setLecturerToLecture(Long lectureId, Lecturer lecturer);

    /**
     * Returns a list of enrolled students associated within given Lecture
     * (straight from database)
     *
     * @param l
     * @return a list of students
     */
    List<Student> getEnrolledStudents(Lecture l);

    /**
     * Externally adds enrolled students to Lecture associated with given
     * identifier
     *
     * @param id
     * @param sts
     */
    void setEnrolledStudents(Long id, List<Student> sts);
}
